import React, { createContext, useState } from "react";
import ChildComponent from "./components/ChildComponent";
export const MyContext = createContext();
const D2UseContext = () => {
  const [data, setData] = useState("Hello World");
  const [year, setYear] = useState(2022);
  return (
    <div>
      <h1>D2UseContext</h1>
      <h1>{year}</h1>
      <MyContext.Provider value={{data,setData,year,setYear}} >
        <ChildComponent />
      </MyContext.Provider>
    </div>
  );
};
export default D2UseContext;
